package com.puyuba.puyuba.view.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.puyuba.puyuba.R;
import com.puyuba.puyuba.bean.GetStudentBean;
import com.puyuba.puyuba.view.activity.ChatActivity;

/**
 * 找学生adapter
 */
public class GetStudentAdatper extends BaseQuickAdapter<GetStudentBean.StudentBean,BaseViewHolder> {

    public GetStudentAdatper(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, GetStudentBean.StudentBean item) {
//        ImageHelper.displayWithCorner(helper.getView(R.id.iv_msg_user),item.getAvatar(),R.mipmap.default_avatar);
        Glide.with(helper.itemView.getContext()).load(item.getAvatar())
                .placeholder(R.mipmap.default_avatar)
                .apply(RequestOptions.bitmapTransform(new CircleCrop()))
                .into((ImageView) helper.getView(R.id.iv_msg_user));
        helper.itemView.setOnClickListener(v -> {
            ChatActivity.startActivity(mContext,item.getHx_uid());
//                ChatActivity.startActivity(mContext,"100");
        });

        helper.setText(R.id.tv_title,item.getUname());
        helper.setText(R.id.tv_time,item.getTime());
        helper.setText(R.id.tv_content,item.getIndustry());
    }
    
}
